﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;
namespace DAO
{
    public class QuyDinhDAO
    {
        DataProvider dp;
        public QuyDinhDAO()
        {
            dp = new DataProvider();
        }
        public DataTable LayQuyDinh()
        {
            DataTable table = new DataTable();
            string sql = "select * from QuyDinh";
            table = dp.LayBangDuLieu(sql);
            return table;
        }
        public bool ThayDoiQuyDinh(QuyDinhDTO qddto)
        {
            bool flag = true;
            string sql = "insert into QuyDinh(ngaythaydoi, luongnhaptoithieu, luongtontoithieutruocnhap, notoida,luongtontoithieusauban, sudungquydinh) values ";
            sql += " ('" + qddto.Ngaythaydoi.ToShortDateString() + "', " + qddto.Luongnhaptoithieu + "," + qddto.Luongtontoithieutruocnhap + "," + qddto.Notoida + "," + qddto.Luongtontoithieu + ",1)";
            if (!dp.ThucHienCauTruyVan(sql)) flag = false;
            return flag;
        }
    }
}
